package com.ai.module.websocket.coder;

import com.ai.module.business.domain.vo.UserMessage;
import com.alibaba.fastjson2.JSONObject;

import javax.websocket.EncodeException;
import javax.websocket.Encoder;
import javax.websocket.EndpointConfig;

/**
 * @author: MrHe
 * @create: 2024-01-27 19:33
 * @description:
 **/

public class UserMessageEncoder implements Encoder.Text<UserMessage> {

    @Override
    public String encode(UserMessage userMessage) throws EncodeException {

        return JSONObject.toJSONString(userMessage);
    }

    @Override
    public void init(EndpointConfig endpointConfig) {

    }

    @Override
    public void destroy() {

    }
}
